<?php 
namespace app\superadmin\controller;
use think\Db;
use think\Controller;
class Order extends Base{
	public function index(){
		$orders=Db::name('order')->alias('a')->join('users u','a.uid=u.uid')->join('videos v','a.vid=v.vid')->where("ustatus='0'")->where("vstatus='0'")->paginate(10);
		$this->assign('orders',$orders);
    //序号
    $page=request()->param('page');
    $page||($page=1);
    $this->assign('page',$page);
		return $this->fetch();
	}
	//屏蔽/解除屏蔽
	public function shield($id){

  $ustatenum=Db::name("order")->where("orderid='$id'")->value('ostatus');

  if($ustatenum==0){
    if (Db::name("order")->where("orderid='$id'")->update(['ostatus'=>1])) {
      $this->redirect('index');
    }else{
      $this->error('解除屏蔽失败');
    }

  }
  else{
    if (Db::name("order")->where("orderid='$id'")->update(['ostatus'=>0])) {
      $this->redirect('index');
    }else{
      $this->error('屏蔽失败');
    }    
  }


	}

}
